﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

public class HPBar : IBornfireRule
{
    public string m_Key => "HPBar";

    public bool m_IsUnlock { get ; set ; }

    public int m_NeedSeconds => 30;

    public IBornfireRule Load()
    {
        return this;
    }

    public void OnBornfireGUI()
    {
        if (!m_IsUnlock)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("血量条（价格） : "+ m_NeedSeconds, Styles.LabelStyle.Value);

            if (Bonfire.m_TotalLifeSeconds >= m_NeedSeconds)
            {
                if (GUILayout.Button("解锁", Styles.ButtonStyle.Value))
                {
                    Bonfire.m_TotalLifeSeconds -= m_NeedSeconds;
                    m_IsUnlock = true;
                }
            }
            else
            {
                GUILayout.Label("寿命不足", Styles.LabelStyle.Value);
            }
            
            GUILayout.EndHorizontal();
        }
    }

    public void OnGUI()
    {
        
    }

    public void OnTopRightGUI()
    {
        if (m_IsUnlock)
        {
            GUILayout.Label("当前血量 1/1", Styles.LabelStyle.Value);
        }
    }

    public void Save()
    {

    }
}
